-- Start of DDL Script for Table BRIDGE.IMPORT_PARAM_VAL
-- Generated 18.09.2013 12:23:30 from BRIDGE@lcnp

CREATE TABLE bridge.import_param_val
    (id                             NUMBER NOT NULL,
    group_id                       NUMBER,
    meta_id                        NUMBER,
    par_id                         NUMBER NOT NULL,
    val                            VARCHAR2(255)
  ,
  CONSTRAINT IMPORT_PARAM_VAL_PK
  PRIMARY KEY (id)
  USING INDEX
  TABLESPACE  users)
  TABLESPACE  users
/





-- Indexes for BRIDGE.IMPORT_PARAM_VAL

CREATE INDEX bridge.import_param_val_meta_nuk ON bridge.import_param_val
  (
    meta_id                         ASC
  )
  TABLESPACE  users
/

CREATE INDEX bridge.import_param_val_group_nuk ON bridge.import_param_val
  (
    group_id                        ASC
  )
  TABLESPACE  users
/



-- Constraints for BRIDGE.IMPORT_PARAM_VAL

ALTER TABLE bridge.import_param_val
ADD CONSTRAINT import_param_val_uk1 UNIQUE (group_id, meta_id, par_id)
USING INDEX
  TABLESPACE  users
/


-- Triggers for BRIDGE.IMPORT_PARAM_VAL

CREATE TRIGGER "BRIDGE"."IMPORT_PARAM_VAL_BI_TRG" 
 BEFORE
  INSERT
 ON bridge.import_param_val
REFERENCING NEW AS NEW OLD AS OLD
 FOR EACH ROW
BEGIN
   IF :NEW.ID = 0 OR :NEW.ID IS NULL
   THEN
      SELECT sq_import_param_val.NEXTVAL
        INTO :NEW.ID
        FROM DUAL;
   END IF;
END;
/


-- End of DDL Script for Table BRIDGE.IMPORT_PARAM_VAL

